package com.ssy.lingxi.report.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 售后维修处理请操作类型枚举
 * @author 伍将
 * @date 2020/11/20
 * @version 2.0.0
 */
public enum AfterSaleRepairHandleOperateTypeEnum {

    /**
     * 待提交审核维修申请单
     */
    TO_BE_VALIFY_COMMIT(1, "待提交审核维修申请单", "/memberCenter/afterService/repairManage/repairPrSubmit"),
    /**
     * 待审核维修申请单（一级）
     */
    TO_BE_VALIFY_STEP1(2, "待审核维修申请单（一级）", "/memberCenter/afterService/repairManage/repairPr1"),
    /**
     * 待审核维修申请单（二级）
     */
    TO_BE_VALIFY_STEP2(3, "待审核维修申请单（二级）", "/memberCenter/afterService/repairManage/repairPr2"),
    /**
     * 待确认维修申请单
     */
    TO_BE_CONFIRM(4, "待确认维修申请单", "/memberCenter/afterService/repairManage/repairPrConfirm");

    /**
     * 编码
     */
    private final Integer code;
    /**
     * 名称
     */
    private final String name;
    /**
     * 链接
     */
    private final String link;


    AfterSaleRepairHandleOperateTypeEnum(Integer code, String name, String link) {
        this.code = code;
        this.name = name;
        this.link = link;
    }

    public static AfterSaleRepairHandleOperateTypeEnum getEnum(Integer code) {
        return Arrays.stream(AfterSaleRepairHandleOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public String getLink() {
        return link;
    }
}
